home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 031a / owlbwcc.zip / BDEFPROC.CPP < prev    next >
C/C++ Source or Header  |  1992-01-26  |  3KB  |  61 lines

  1. /**********************************************************************/
  2. /*                 BDEFPROC.cpp by Bob Bourbonnais                    */
  3. /*              released to the public domain 1/26/92                 */
  4. /*         This program shows how to add a default button             */
  5. /*        processing function to a dialog box main window.            */
  6. /*        To add the same functionality to a regular window           */
  7. /*        over ride DefCommandProc instead of DefChildProc.           */
  8. /**********************************************************************/
  9. #include <owl.h>
  10. #include <dialog.h>
  11. #include "bwcc.h"                          // needed for BWCC
  12.  
  13. class TMyDialog : public TDialog           // derive a class to add
  14.   {                                        // default button handling
  15.   public:
  16.     TMyDialog(LPSTR lpDialogName)          // constructor calls
  17.       : TDialog(NULL,lpDialogName)         // base class constructor
  18.       {
  19.       BWCCGetVersion();    // activate Borland Windows Custom Controls
  20.       }
  21.     virtual void DefChildProc(RTMessage Msg); // default button handler
  22.   };
  23.  
  24. void TMyDialog::DefChildProc(RTMessage Msg)   // default button handler
  25.   {
  26.   MessageBeep(0);                             // make sound and display
  27.   BWCCMessageBox(HWindow,"Not Implemented",   // a BWCC message box
  28.          "Feature",MB_OK);
  29.   TDialog::DefChildProc(Msg);                 // pass messages along
  30.   }                                           // to base class handler
  31.  
  32. class TDialog1App : public TApplication  // Application Class to contain
  33.   {                                      // the application
  34.   public:
  35.     TDialog1App(LPSTR lpName, HANDLE hInstance,  // constructor calls the
  36.         HANDLE hPrevInstance,            // base class constructor
  37.         LPSTR lpCmdLine, int nCmdShow)
  38.         :TApplication(lpName, hInstance,
  39.                   hPrevInstance,
  40.                   lpCmdLine, nCmdShow) {};
  41.  
  42.     virtual void InitMainWindow(); // overrides base class InitMainWindow
  43.   };
  44.  
  45. void TDialog1App::InitMainWindow() // to initialize a dialog box
  46.   {                                // as the main window
  47.   MainWindow = new TMyDialog("MAINWINDOWDIALOG");
  48.   }
  49.  
  50. int PASCAL WinMain(HANDLE hInstance,              // main entry point from
  51.            HANDLE hPrevInstance,          // windows to this program
  52.            LPSTR lpCmdLine , int nCmdShow)
  53.   {
  54.   TDialog1App Dialog1("Dialog Tester",hInstance,  // create instance of
  55.                hPrevInstance,             // the dialog application
  56.                lpCmdLine,nCmdShow);
  57.   Dialog1.Run();                                  // run it
  58.   return (Dialog1.Status);                        // exit
  59.   }
  60. /**********************************************************************/
  61.